<!--
Copyright 2012 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE html><meta charset="UTF-8">
<style>
.animation {
  position: absolute;
  width: 25px;
  height: 25px;
  top: 0px;
  left: 0px;
  background: lightsteelblue;
}
.expectation {
  background: red;
  position: absolute;
  width: 25px;
  height: 25px;
  top: 0px;
  left: 0px;
}
#eTR {
  -webkit-transform: translate(387.5px, 87.5px);
  transform: translate(387.5px, 87.5px);
}
#eBL {
  -webkit-transform: translate(87.5px, 287.5px);
  transform: translate(87.5px, 287.5px);
}
#eBR, #animBR {
  -webkit-transform: translate(387.5px, 287.5px);
  transform: translate(387.5px, 287.5px);
}
svg {
position:absolute;
top: 0px;
left: 0px;
width: 800px;
height: 600px;
}
</style>

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <path id=pathTR d="M400,100l0,0l0,-50l100,0l86.3325,122.665z" />
  <path d="M400,100l0,0l0,-50l100,0l86.3325,122.665z" stroke="black"
      stroke-width="1" fill="none" />
  <path id=pathBL d="M100,300l0,0l0,-50l100,0l86.3325,122.665z" />
  <path d="M100,300l0,0l0,-50l100,0l86.3325,122.665z" stroke="black"
      stroke-width="1" fill="none" />
  <path id=pathBR d="M400,300l0,0l0,-50l100,0l86.3325,122.665z" />
  <path d="M400,300l0,0l0,-50l100,0l86.3325,122.665z" stroke="black"
      stroke-width="1" fill="none" />
</svg>

<div id="eTR" class="expectation"></div>
<div id="animTR" class="animation">&rarr;</div>
<div id="eBL" class="expectation"></div>
<div id="animBL" class="animation">&rarr;</div>
<div id="eBR" class="expectation"></div>
<div id="animBR" class="animation">&rarr;</div>

<script>
var expected_failures = [
  {
    browser_configurations: [{ firefox: true }],
    tests: [
      '#animTR at t=(0|(1|2|10|11)000)ms',
      '#animBL at t=(0|(7|8|10)000)ms',
      '#animBR at t=(0|10000)ms',
    ],
    message: 'Doesn\'t quite follow path correctly.',
  }, {
    browser_configurations: [{ firefox: true, version: '29|30|31' }],
    tests: [
      '#animTR at t=9000ms',
      '#animBL at t=5000ms',
      '#animBR at t=(3|8|9)000ms',
    ],
    message: 'Doesn\'t quite follow path correctly.',
  }, {
    browser_configurations: [{ msie: true }],
    tests: [
      '#animTR at t=(0|(1|2|3|4|9|10|11)000)ms',
      '#animBL at t=(0|(1|3|4|7|8|10|11)000)ms',
      '#animBR at t=(0|(1|3|9|10|11)000)ms',
    ],
    message: 'Doesn\'t quite follow path correctly.',
  }
];
</script>
<script src="../bootstrap.js"></script>
<script>
"use strict";

var animFuncTR = new MotionPathEffect(
    document.querySelector('#pathTR').pathSegList, 'auto-rotate');
document.timeline.play(new Animation(document.querySelector("#animTR"),
    animFuncTR, {duration: 10 * 1000, iterations: 2}));

var animFuncBL = new MotionPathEffect(
    document.querySelector('#pathBL').pathSegList, 'auto-rotate');
document.timeline.play(new Animation(
    document.querySelector("#animBL"), animFuncBL,
    {duration: 10 * 1000, iterations: 2, easing: "paced"}));

var animFuncBRKeyFrames = new KeyframeEffect(
    [{transform: "translate(387.5px, 287.5px) rotate(180deg)"}], "replace");
var animFuncBRPath = new MotionPathEffect(
    document.querySelector('#pathBR').pathSegList, 'auto-rotate');
var animBR = new Animation(document.querySelector("#animBR"), animFuncBRPath,
    {duration: 10 * 1000, iterations: 2, easing: "paced"});
document.timeline.play(animBR);

testharness_timeline.schedule(function() {
    animBR.effect = animFuncBRKeyFrames;
}, 3000);
testharness_timeline.schedule(function() {
    animBR.effect = animFuncBRPath;
}, 6000);
</script>
